using System.Text;

namespace etcetera.Mvc.UI.Toolbar
{
    public class ToolbarSelect : ToolbarItem
    {
        private readonly int[] _options;

        public ToolbarSelect(params int[] options)
        {
            _options = options;
        }

        public override string GetValue()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<div class='{0}'>", "tCtrl");
            PagerToolStrip toolStrip = (PagerToolStrip)Toolbar.ToolStrip;
            sb.AppendFormat("<select id='{0}'>", toolStrip.Id + "PS");
            foreach (int option in _options)
            {
                sb.AppendFormat("<option value='{0}'>{0}", option);
            }
            sb.Append("</select>");
            sb.Append("</div>");
            return sb.ToString();
        }
    }
}